/*
 * @lc app=leetcode.cn id=263 lang=csharp
 *
 * [263] 丑数
 */

// @lc code=start
public class Solution {
    public bool IsUgly(int n) {
        if (n <= 0) return false;
        int[] factors = {2, 3, 5};
        foreach (var factor in factors) {
            while (n % factor == 0) {
                n /= factor;
            }
        }
        return n == 1;
    }
}
// @lc code=end

